<#include "../common/layout/__mainlayout.html">

    <!--设置面包屑-->
    <#assign pageBreadCrumbs>
        <li class="active"><a href="${ctx}/admin/softTag/softTagList.html">标签管理</a></li>
        <li class="active">${softTag.tagName!}</li>
    </#assign>

<#assign pageCss>
    <!-- page specific plugin styles -->
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css" />
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/select2.css" />
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css" />
    <link href="${ctx}/static/admin/assets/treeTable/v3.0.0/css/jquery.treetable.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/static/admin/assets/treeTable/v3.0.0/css/jquery.treetable.theme.default.css" rel="stylesheet" type="text/css" />
</#assign>
<#assign pageJavascript>


<script src="${ctx}/static/admin/assets/treeTable/v3.0.0/js/jquery.treetable.js"> </script>
    <script type="text/javascript">
        $(document).ready(function(){

            if(!ace.vars['touch']) {
                $('.chosen-select').chosen({allow_single_deselect:true});
            }

            $("#editModal").on("hidden.bs.modal", function(){
                $(this).removeData("bs.modal");
            });

            // 删除按钮
            $("a.delete").on(ace.click_event, function(e){
                var currentA = this;
                e.preventDefault();
//                bootbox.setDefaults({locale:"zh_CN"});
                bootbox.confirm({
                            message: "确定删除该关联软件?",
                            buttons: {
                                confirm: {
                                    label: "确定",
                                    className: "btn-primary btn-sm"
                                },
                                cancel: {
                                    label: "取消",
                                    className: "btn-sm"
                                }
                            },
                            callback: function(result) {
                                if(result){
                                    $.ajax({
                                        type: "POST",
                                        url: $(currentA).attr("href"),
                                        dataType: 'text',
                                        success: function(msg){
                                            var msg = eval("("+msg+")");
                                            if(msg.result == "success"){
                                                window.location="${refer!}";
                                            }else{
                                                alert(msg.messages);
                                                //bootbox.alert(msg.messages);
                                            }
                                        },
                                        error: function(){
                                            bootbox.alert("删除失败");
                                        }
                                    });
                                }
                            }
                        }
                );
            });


        });
    </script>
</#assign>

<@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="categoryFlag">
    <div class="row">
        <div class="col-xs-12">
            <form id="searchForm" action="${ctx}/admin/menu/list.html" class="form-search form-inline" method="GET">

                <button type="button" class="btn btn-sm" onclick="window.location='${ctx}/admin/softTag/softTagList.html';"><i class="ace-icon fa fa-times"></i> 返回</button>
                <a href="${ctx}/admin/softTag/viewTagSoftMap.do?tagId=${softTag.tagId!}" class="btn btn-sm btn-warning" data-toggle="modal" data-target="#editModal"><i class="ace-icon fa fa-plus"></i>添加</a>

                <table id="softTagTable" class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th width="40" align="center">标签编号</th>
                        <th width="40" align="center">应用编号</th>
                        <th width="100" align="center">应用名称</th>
                        <th width="100" align="center">状态</th>
                        <th width="100" align="center">操作</th>
                    </tr>
                    </thead>
                    <tbody id="softtbody">
                    <#if softMaps??>
                        <#list softMaps as softMap>
                            <tr>
                                <td  align="center">${softMap.tagId!}</td>
                                <td  align="center">${softMap.softId!}</td>
                                <td  align="center">${softMap.softName!}</td>
                                <td  align="center">
                                    <#if softTag.state == 0>
                                        显示
                                    <#elseif  softTag.state = -1>
                                        删除
                                     <#else>
                                    </#if>
                                </td>
                                <td  align="center">
                                    <a class="green tooltip-success edit"
                                       href="${ctx}/admin/softTag/viewTagSoftMap.do?id=${softMap.id}" data="${softMap.id!}"  data-toggle="modal" data-target="#editModal"><span
                                            class="label label-success">修改</span></a>
                                    <a class="red tooltip-error delete"
                                       href="${ctx}/admin/softTag/deleteSoftMap.do?id=${softMap.id!}" data-rel="tooltip"
                                       title="删除"> <span class="label label-danger">删除</span></a>
                                </td>
                            </tr>
                        </#list>
                    </#if>
                    </tbody>
                </table>
            </form>
        </div>
    </div>

    <div id="editModal" class="modal fade" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
            </div>
        </div>
    </div>
</@mainlayout>